home *** CD-ROM | disk | FTP | other *** search
/ PC Answers 1995 May / PC Answers CD-ROM 7 (Future Publishing) (May 1995).iso / vbits / code / cert / trk3_eg / fmdrgdrp / opt2 / invent.exe / OBROWSE.BAS < prev    next >
Encoding:
BASIC Source File  |  1993-08-20  |  2.5 KB  |  95 lines

  1. 'Array to hold obrowse forms
  2.  
  3. Const MAX_OBROWSE = 3
  4. Global OBrowseFormItems(MAX_OBROWSE) As FormItem
  5. Global OBrowseForms(MAX_OBROWSE) As OBrowseForm
  6.  
  7. Global OBrowseSchema() As TABLESCHEMA
  8.  
  9. Sub InitOBrowse ()
  10.     FormInit OBrowseFormItems()
  11.  
  12.     ReDim OBrowseSchema(14)
  13.  
  14.     ' Determines the record type, always present
  15.  
  16.     OBrowseSchema(1).tsName = "IsDetail"
  17.     OBrowseSchema(1).tsType = DB_BOOLEAN
  18.  
  19.     ' Present in header and detail record, value is the
  20.     ' same for both
  21.  
  22.     OBrowseSchema(2).tsName = "OrderNo"
  23.     OBrowseSchema(2).tsType = DB_LONG
  24.     
  25.     ' Present only in header, NULL in detail records
  26.  
  27.     OBrowseSchema(3).tsName = "CustNo"
  28.     OBrowseSchema(3).tsType = DB_LONG
  29.  
  30.     OBrowseSchema(4).tsName = "CustName"
  31.     OBrowseSchema(4).tsType = DB_TEXT
  32.     OBrowseSchema(4).tsSize = 80
  33.  
  34.     OBrowseSchema(5).tsName = "OrderDate"
  35.     OBrowseSchema(5).tsType = DB_DATE
  36.  
  37.     OBrowseSchema(6).tsName = "ShipAddr"
  38.     OBrowseSchema(6).tsType = DB_TEXT
  39.     OBrowseSchema(6).tsSize = 80
  40.  
  41.     OBrowseSchema(7).tsName = "ShipCity"
  42.     OBrowseSchema(7).tsType = DB_TEXT
  43.     OBrowseSchema(7).tsSize = 20
  44.  
  45.     OBrowseSchema(8).tsName = "ShipState"
  46.     OBrowseSchema(8).tsType = DB_TEXT
  47.     OBrowseSchema(8).tsSize = 10
  48.  
  49.     OBrowseSchema(9).tsName = "ShipZip"
  50.     OBrowseSchema(9).tsType = DB_TEXT
  51.     OBrowseSchema(9).tsSize = 20
  52.     
  53.     ' Present only in detail records, NULL in header
  54.  
  55.     OBrowseSchema(10).tsName = "PartNo"
  56.     OBrowseSchema(10).tsType = DB_LONG
  57.  
  58.     OBrowseSchema(11).tsName = "Description"
  59.     OBrowseSchema(11).tsType = DB_TEXT
  60.     OBrowseSchema(11).tsSize = 80
  61.  
  62.     OBrowseSchema(12).tsName = "Quantity"
  63.     OBrowseSchema(12).tsType = DB_INTEGER
  64.  
  65.     OBrowseSchema(13).tsName = "Price"
  66.     OBrowseSchema(13).tsType = DB_CURRENCY
  67.  
  68.     ' Present in both, full total for order header
  69.  
  70.     OBrowseSchema(14).tsName = "Total"
  71.     OBrowseSchema(14).tsType = DB_CURRENCY
  72.  
  73. End Sub
  74.  
  75. Sub OBrowseOpen (fname As String, tbname As String)
  76.     
  77.     ' Open a new order browser and set up its form
  78.     ' structure
  79.  
  80.     If Not FormAvail(OBrowseFormItems()) Then
  81.     MsgBox "Cannot open more order browsers"
  82.     Exit Sub
  83.     End If
  84.     
  85.     i% = FormAlloc(OBrowseFormItems())
  86.     OBrowseFormItems(i%).fiFileName = fname
  87.     OBrowseFormItems(i%).fiTable = tbname
  88.  
  89.     Set OBrowseForms(i%) = New OBrowseForm
  90.     OBrowseForms(i%).Show
  91.     OBrowseForms(i%).Caption = "[" + ExtractBase(fname) + "]" + TnameDisp(tbname)
  92.  
  93. End Sub
  94.  
  95.